<template>
	<view class="search-view">
		<view class="search-header">
			<image class="black" @tap="black" src="/static/images/zuo.png" mode=""></image>
			<view class="top-right">
				<image class="search" src="/static/images/search.png" mode=""></image>
				<input type="text" @input="orderNum" :value="orderNumber" class="search-input" placeholder="订单编号搜索" placeholder-class="sty" />
				<image  class="xh" @tap="clear" src="/static/images/xh.png" mode=""></image>
			</view>
			
			<view class="searcg-txt" @tap="search">搜索</view>
		</view>
		<!-- 订单列表 -->
		<order-list :list="orderList"></order-list>
		<!-- 订单为空 -->
		
		
		
		
		
		
		
		
		
		
	</view>
</template>

<script>
	const util = require("../../utils/util.js");
	//获取应用实例
	const api = require("../../config/api.js"); 
	import orderList from "../../components/orderList/orderList"; 
	export default { 
		data() {
			return {
				// 搜索的订单号
				orderNumber:'',
				// 拒绝理由
				reasonRefusal:'',
				// 订单遮罩控制
				orderDrop:false,
				// 订单列表
				orderList:[],
				identity:0
			}
		},
		components: {
		  orderList
		},
		onLoad(){
			// 获取身份
			this.identity = uni.getStorageSync('identity')
		},
		methods: {
			// 获取输入的订单号
			orderNum(e){
				this.orderNumber = e.detail.value
			},
			// 清除搜索内容
			clear(){
				console.log(123)
				this.orderNumber = ''
			},
			black(){
				uni.navigateBack()
			},
			// 搜索
			search(){
				// 获取订单列表
				
				// 获取订单详情
				util.request(api.businessOrderList, {
					orderSn:this.orderNumber
				}, 'POST').then(res => {
					if(res.error==0){
						this.orderList = res.data.data
					}
				})
				
			}
			
			
		}
	}
</script>

<style>
	@import url("./search.css");
</style>
